package com.aspose.cells.a.d;

import com.aspose.cells.Color;

public class zeb {
   private zdh a;
   private zew b;
   private zes c;
   private static float[] d = new float[0];
   private static float[] e = new float[]{3.0F, 1.0F};
   private static float[] f = new float[]{1.0F, 1.0F};
   private static float[] g = new float[]{3.0F, 1.0F, 1.0F, 1.0F};
   private static float[] h = new float[]{3.0F, 1.0F, 1.0F, 1.0F, 1.0F, 1.0F};

   private zeb() {
   }

   public zeb(zdh var1, zes var2, zew var3) {
      this.a = var1;
      this.c = var2;
      this.b = var3;
   }

   public void a(zs var1) throws Exception {
      if (var1.i == 0) {
         Color var2 = var1.a;
         if (this.a.b().u() && (var2.getA() & 255) < 255) {
            var2 = a(var2, Color.fromArgb(255, 255, 255, 255));
         }

         this.a.i().a(var2, true, this.b);
      } else {
         this.a(var1.j, true);
      }

      this.a.i().c(var1.b, this.b);
      int var6 = b(var1);
      this.a.i().b(var6, this.b);
      int var3 = c(var1);
      this.a.i().c(var3, this.b);
      if (var1.f == 3) {
         this.a.i().d(var1.h, this.b);
      }

      if (var1.g != 0) {
         int var4 = 0;
         if (var6 == 0) {
            var4 = d(var1);
            this.a.i().b(var4, this.b);
         }

         if (var1.a() != null && var1.a().length > 0) {
            float[] var5 = a(var1, var6 != 0 || var4 != 0);
            this.a.i().a(var5, var1.k, this.b);
         }
      }

   }

   public void a(com.aspose.cells.b.a.b.zc var1, boolean var2) throws Exception {
      com.aspose.cells.b.a.b.zu var3 = (com.aspose.cells.b.a.b.zu)com.aspose.cells.b.a.zl.a(var1, com.aspose.cells.b.a.b.zu.class);
      if (var3 != null) {
         Color var7 = var3.a();
         if (this.a.b().u() && (var7.getA() & 255) < 255) {
            var7 = a(var7, Color.fromArgb(255, 255, 255, 255));
         }

         this.a.i().a(var7, var2, this.b);
      } else {
         com.aspose.cells.b.a.b.zx var4 = (com.aspose.cells.b.a.b.zx)com.aspose.cells.b.a.zl.a(var1, com.aspose.cells.b.a.b.zx.class);
         com.aspose.cells.b.a.b.a.zg var5 = (com.aspose.cells.b.a.b.a.zg)com.aspose.cells.b.a.zl.a(var1, com.aspose.cells.b.a.b.a.zg.class);
         if (var5 != null || var4 != null) {
            zeo var6 = this.c.b(var1);
            if (this.a.h() != null) {
               var6.b(this.a.h().m());
            }

            this.a.i().a(zdg.d(), var2, this.b);
            this.b.c(com.aspose.cells.b.a.zr.a((new StringBuilder(32)).append("/").append(var6.p()).append(' ').append(var2 ? "SCN" : "scn")));
         }
      }
   }

   public void a(com.aspose.cells.b.a.b.za var1, com.aspose.cells.b.a.b.zo var2, com.aspose.cells.b.a.b.zt var3, long var4) throws Exception {
      zdd var6 = new zdd(var1, this.a.b().u());
      this.a((zee)var6, var2, var3, var4);
   }

   public void a(zee var1, com.aspose.cells.b.a.b.zo var2, com.aspose.cells.b.a.b.zt var3) throws Exception {
      this.a.i().a(this.b);
      com.aspose.cells.b.a.b.a.zi var4 = new com.aspose.cells.b.a.b.a.zi(var3.b(), 0.0F, 0.0F, -var3.c(), var2.d(), var2.e() + var3.c());
      this.a.i().a(var4, this.b);
      if (var1.g() && var1.e() != zdg.c()) {
         zed.a(this.b, var1);
      } else {
         zed var5 = this.c.a(var1);
         if (this.a.h() != null) {
            var5.b(this.a.h().m());
         }

         this.b.c("/" + var5.p() + " Do");
      }

      this.a.i().b(this.b);
      var4 = null;
   }

   public void a(zee var1, com.aspose.cells.b.a.b.zo var2, com.aspose.cells.b.a.b.zt var3, long var4) throws Exception {
      this.a.i().a(this.b);
      com.aspose.cells.b.a.b.a.zi var6 = new com.aspose.cells.b.a.b.a.zi(var3.b(), 0.0F, 0.0F, -var3.c(), var2.d(), var2.e() + var3.c());
      this.a.i().a(var6, this.b);
      if (var1.g() && var1.e() != zdg.c()) {
         zed.a(this.b, var1);
      } else {
         zed var7 = this.c.a(var1, var4);
         if (this.a.h() != null) {
            var7.b(this.a.h().m());
         }

         this.b.c("/" + var7.p() + " Do");
      }

      this.a.i().b(this.b);
   }

   private static int b(zs var0) {
      switch(var0.c) {
      case 1:
         return 2;
      case 2:
         return 1;
      default:
         switch(var0.d) {
         case 1:
            return 2;
         case 2:
            return 1;
         default:
            return 0;
         }
      }
   }

   private static int c(zs var0) {
      switch(var0.f) {
      case 1:
         return 2;
      case 2:
         return 1;
      default:
         return 0;
      }
   }

   private static int d(zs var0) {
      switch(var0.e) {
      case 2:
         return 1;
      default:
         return 0;
      }
   }

   public static float[] a(zs var0, boolean var1) throws Exception {
      float[] var2;
      switch(var0.g) {
      case 0:
         var2 = d;
         break;
      case 1:
         var2 = e;
         break;
      case 2:
         var2 = f;
         break;
      case 3:
         var2 = g;
         break;
      case 4:
         var2 = h;
         break;
      case 5:
         var2 = var0.a();
         break;
      default:
         throw new Exception("Unknown dash style.");
      }

      var2 = (float[])com.aspose.cells.b.a.zl.a(com.aspose.cells.b.a.za.a(var2), float[].class);
      a(var0, var2, var1);
      return var2;
   }

   private static void a(zs var0, float[] var1, boolean var2) {
      float var3 = Math.max(var0.b, 1.0F);

      for(int var4 = 0; var4 < var1.length; ++var4) {
         float var5;
         if (zcq.b((long)var4)) {
            var5 = var1[var4];
            if (var2) {
               ++var5;
            }

            var1[var4] = var5 * var3;
         } else {
            var5 = var1[var4];
            if (var2) {
               --var5;
            }

            var1[var4] = var5 * var3;
         }
      }

   }

   public static Color a(Color var0, Color var1) {
      double var2 = (double)(var0.getA() & 255) / 255.0D;
      double var4 = 1.0D - var2;
      int var6 = (int)com.aspose.cells.b.a.zq.a((double)(var0.getR() & 255) * var2 + (double)(var1.getR() & 255) * var4);
      int var7 = (int)com.aspose.cells.b.a.zq.a((double)(var0.getG() & 255) * var2 + (double)(var1.getG() & 255) * var4);
      int var8 = (int)com.aspose.cells.b.a.zq.a((double)(var0.getB() & 255) * var2 + (double)(var1.getB() & 255) * var4);
      return Color.fromArgb(255, var6, var7, var8);
   }
}
